<!--
@ 作者: 阿拉丁矿工 黄传鸿 <hchhyzc@foxmail.com>
  @mousedown="onCanvasMouseDown" @mousemove="onCanvasMouseMove" @mouseup="onCanvasMouseUp"
    @mousewheel="onCanvasWheel"
-->
<template>
  <div class="h_panel_canvas" id="h_panel_canvas" :style="{
    width: canvasAttr.canvasWidth * canvasAttr.canvasScale + 'px',
    height: canvasAttr.canvasHeight * canvasAttr.canvasScale + 'px',
  }">


    <!-- DIV图元 层    -->
    <layer-pel-div></layer-pel-div>
    <!-- SVG图元 层  -->
    <layer-pel-svg></layer-pel-svg>
    <!-- 辅助 层 -->
    <svg class="panel_svg_group" width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg"
      xmlns:xlink="http://www.w3.org/1999/xlink">
      <!-- 绘制显示包 -->
      <g id="DrawShowLayer" :style="{ transform: 'scale(' + canvasAttr.canvasScale + ')' }"></g>
      <!-- 选择包 -->
      <LayerSelect></LayerSelect>
      <!-- 光标包 -->
      <LayerCursor></LayerCursor>
      <!-- 编辑包 -->
      <layer-edit></layer-edit>
    </svg>
  </div>
</template>

<script setup lang="ts">
/* ================================================================================================ */
// 🍀引入
/* ================================================================================================ */
/**图元端函数引入*/
import {
  onCanvasMouseDown,
  onCanvasMouseMove,
  onCanvasMouseUp,
  onCanvasWheel,
  onRightClick,
} from "@/functions";
/**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// 🐸 引入组件
/**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
import { LayerPelDiv } from "./component/LayerPelDiv";
import { LayerPelSvg } from "./component/LayerPelSvg";
import { LayerSelect } from "./component/LayerSelect";
import { LayerCursor } from "./component/LayerCursor";
import { LayerEdit } from "./component/LayerEdit";
import { storeToRefs } from "pinia";// 引入pinia
import { useEditorStore } from "../../store"; // 引入存储
const myStore = useEditorStore(); // 使用存储
let {
  canvasAttr
} = storeToRefs(myStore);//解构-画布

</script>


<style lang="scss" scoped>
.h_panel_canvas {
  position: absolute;
  top: 0px;
  left: 0px;
  z-index: 2000;
}

#h_canvas {
  position: absolute;
  top: 0px;
  left: 0px;
  z-index: 2001;
}

.panel_svg_group {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100%;
}
</style>
